<!--{template /module/admin/view/head}-->
<div id="left_layout">
	<div id="main_content" class="container-fluid">
		<div class="row-fluid">
			<div class="well widget" style="margin-bottom:0; padding:19px 19px 10px 19px;">
				<div class="widget-header">
					<a href="{$ADMIN_SCRIPT}/admin/file" target="_parent">{lang admin.file.view.header}</a>
					<!--{loop $path_crumbs $crumb}-->
					/ <a href="{$ADMIN_SCRIPT}/admin/file&path=/{$crumb[path]}" target="_parent">{$crumb[name]}</a>
					<!--{/loop}-->
					/ <a href="{$ADMIN_SCRIPT}/admin/file/_ilinei&file={$file[name]}&path={$_var[gp_path]}" target="_parent">{$file[name]}</a>
				</div>
				<div class="widget-content">
					<div class="action-wrapper">
						<div class="pull-left">
							<button type="button" class="btn btn-mini btn-primary btn-save">{lang admin.ilinei.frame_top.view.button.save}</button>
							<button type="button" class="btn btn-mini btn-code">{lang admin.ilinei.frame_top.view.button.code}</button>
							<button type="button" class="btn btn-mini btn-add-block">{lang admin.ilinei.frame_top.view.button.block.add}</button>
						</div>
						<div class="pull-right">
							<button type="button" class="btn btn-mini btn-success btn-view">{lang admin.ilinei.frame_top.view.button.view}</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$(function(){
        $('.btn-save').click(function(){
            parent.frames['frm_ilinei_content'].save();
        });

        $('.btn-code').click(function(){
            if($(this).hasClass('btn-success')){
                $('.btn-save').removeAttr('disabled');

                $(this).text('{lang admin.ilinei.frame_top.view.button.code}').removeClass('btn-success');

                parent.document.getElementById('frm_ilinei_content').src = '{$ADMIN_SCRIPT}/admin/file/_ilinei&frame=content&file={$_var[gp_file]}&path={$_var[gp_path]}';
            }else{
                $('.btn-save').attr('disabled', true);

                $(this).text('{lang admin.ilinei.frame_top.view.button.design}').addClass('btn-success');

                parent.document.getElementById('frm_ilinei_content').src = '{$ADMIN_SCRIPT}/admin/file/_ilinei&frame=content&do=design&file={$_var[gp_file]}&path={$_var[gp_path]}';
            }
        });

        $('.btn-view').click(function(){
            if($(this).hasClass('btn-success')){
                $('.btn-save').attr('disabled', true);
                $('.btn-code').attr('disabled', true);
                $('.btn-add-block').attr('disabled', true);

                $(this).text('{lang admin.ilinei.frame_top.view.button.edit}').removeClass('btn-success');

                parent.document.getElementById('frm_ilinei_content').src = '{$ADMIN_SCRIPT}/admin/file/_ilinei&frame=content&do=view&file={$_var[gp_file]}&path={$_var[gp_path]}';
			}else{
                $('.btn-save').removeAttr('disabled');
                $('.btn-code').removeAttr('disabled');
                $('.btn-add-block').removeAttr('disabled');

                $(this).text('{lang admin.ilinei.frame_top.view.button.view}').addClass('btn-success');
                $('.btn-code').text('{lang admin.ilinei.frame_top.view.button.code}').removeClass('btn-success');

                parent.document.getElementById('frm_ilinei_content').src = '{$ADMIN_SCRIPT}/admin/file/_ilinei&frame=content&file={$_var[gp_file]}&path={$_var[gp_path]}';
			}
        });

		$('.btn-add-block').click(function(){
            parent.frames['frm_ilinei_content'].block_add();
		});

        $('.btn-add-column').click(function(){
            parent.frames['frm_ilinei_content'].column_add();
        });
    });
</script>
<!--{template /module/admin/view/foot}-->